<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .title {
      height: 50px;
      background-color: aquamarine;
    }
    .title2 {
      height: 50px;
      background-color: rgb(173, 147, 30);
    }
    #cc {
      position: absolute;
      height: 30px;
      width: 30px;
      background-color: red;
    }
  </style>
  <script>
    function test(e) {
      cc.style.top = e.clientY + 'px';
      cc.style.left = e.clientX + 'px';
    }
  </script>
</head>
<body>

  <div class="title" onclick="test(event)">
    test
  </div>
  <!-- <div class="title2" onclick="test(event)">
    test2
  </div> -->
  <!-- <input/> -->
  <div id="cc"></div>
  
</body>
</html>